package com.manager.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.manager.cms.bo.UserReceiver;
import com.manager.cms.common.Pageable;
import com.manager.cms.mapper.UserReceiverMapper;
import com.manager.cms.service.UserReceiverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author 
 * @version v1.0
 * @date 2020-05-19
 */
@Service
public class UserReceiverServiceImpl implements UserReceiverService {

    @Autowired
    private UserReceiverMapper userReceiverMapper;

    @Override
    public void insert(UserReceiver record) {
        userReceiverMapper.insert(record);
    }

    @Override
    public void update(UserReceiver record){
        userReceiverMapper.update(record);
    }

    @Override
    public void del(String id){
        userReceiverMapper.del(id);
    }

    @Override
    public UserReceiver selectByPrimaryKey(String id){
        return userReceiverMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<UserReceiver> getList(UserReceiver record){
        return userReceiverMapper.selectByRecord(record);
    }

    @Override
    public Pageable<UserReceiver> pageList(UserReceiver record, Integer pageNum, Integer pageSize){
        Integer count = userReceiverMapper.countByRecord(record);
        PageHelper.startPage(pageNum, pageSize);
        List<UserReceiver> list = userReceiverMapper.selectByRecord(record);
        return new Pageable<>(list, count, pageSize, pageNum);
    }

}